package strings;

import static net.mindview.util.Print.print;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.junit.Ignore;
import org.junit.Test;

public class FindingMY {
	
	@Test
	@Ignore
	public void test001() {
		Matcher m = Pattern.compile("\\w+").matcher(
				"Evening is full of the linnet's wings");
		while (m.find())
			print(m.group() + " ");
		print("-------------------------");
		int i = 0;
		while (m.find(i)) {
			print(m.group() + " ");
			i++;
		}
	}
	
	/**
	 * 
	 * 可以拿来抽取单词。
	 * [a-zA-Z]+('[a-zA-Z]+)?
	 * 
	 */
	@Test
	public void test002() {
		Matcher m = Pattern.compile("[a-zA-Z]+('[a-zA-Z]+)?").matcher(
				"Evening is full of the linnet's wings");
		while (m.find())
			print(m.group() + " ");
		print("-------------------------");
		int i = 0;
		while (m.find(i)) {
			print(m.group() + " ");
			i++;
		}
	}
	
}
